<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="./css/animate.css">
    <script src="./js/vue.js"></script>
    <style>
        #app {
            padding: 10px;
            margin-bottom: 400px;
        }

        .child {
            margin: 20px;
            padding: 10px;
            background-color: #cccccc;
        }
    </style>

</head>
<body>
    <div id="app">
        <h3>父组件</h3>
        <child-one>
            <template v-slot:default="data">
                <p>测试标签-msg:{{ data.msg }}</p>
            </template>
            <template v-slot:a=" {msg,aaa} ">
                <p>实现对具名a进行替换-msg:{{ msg }}</p>
                <p>实现对具名a进行替换-aaa:{{ aaa }}</p>
            </template>
        </child-one>
    </div>
    <template id="ChildOne">
        <div class="child" id="组件one">
            <h3>子组件one</h3>
            <!-- 分发占位符 -->
            <slot :msg="msg" :aaa="'aaaa'"></slot>
            <h3>子组件one</h3>
            <slot name="a" :msg="msg" :aaa="'aaaa'"></slot>
            <h3>子组件one</h3>
        </div>
    </template>
</body>
<script>
    Vue.component("ChildOne", {
        template: "#ChildOne",
        data(){
            return {
                msg:"ChildOne的msg"
            }
        }
    });
    new Vue({
        el: "#app",
        data:{
            msg:"new Vue的msg"
        }
    });

</script>

</html>